package com.iwhalecloud.citybrain.flow.platform.manager.application.service;

import com.iwhalecloud.citybrain.flow.platform.manager.domain.exception.EventCallSuspendException;
import org.flowable.engine.common.api.delegate.event.FlowableEvent;
import org.flowable.engine.delegate.event.impl.FlowableEntityEventImpl;

/**
 * @author lilh
 * @date 2019-01-28 16:39
 */
public abstract class AbstractEntityEventHandler implements CustomEventHandler {

    @Override
    public void handle(FlowableEvent event) throws EventCallSuspendException {
        if (!FlowableEntityEventImpl.class.isAssignableFrom(event.getClass())) {
            //
            return;
        }

        doHandle((FlowableEntityEventImpl) event);
    }

    /**
     * 处理
     *
     * @param event 事件
     */
    protected abstract void doHandle(FlowableEntityEventImpl event) throws EventCallSuspendException;
}
